﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.ServiceHosting.ServiceRuntime;

namespace Dtyo_WebRole.Dep
{
    public partial class DepList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Timer1.Enabled = true;
            }



        }

        protected void SaveDepartmentButton_Click(object sender, EventArgs e)
        {
            RoleManager.WriteToLog("Information", string.Format("Creating new department"));
            Console.WriteLine("just want to see smthing");

            Department newEntry = new Department() { Name = txtName.Text, Description = txtDescription.Text };
            DtyoDataSource ds = new DtyoDataSource();
            ds.AddDepartment(newEntry);

            txtName.Text = "";
            txtDescription.Text = "";

            DepartmentList.DataBind();
        }
        protected void Timer1_Tick(object sender, EventArgs e)
        {
            DepartmentList.DataBind();
        }
    }
}